# Maintainer: Balló György <ballogyor+arch at gmail dot com>

_pkgname=pyocr
pkgname=python-pyocr
pkgver=0.8.3
pkgrel=2
pkgdesc='Python wrapper for Tesseract and Cuneiform'
arch=('any')
url='https://gitlab.gnome.org/World/OpenPaperwork/pyocr'
license=('GPL3')
depends=('python-pillow' 'python-six')
makedepends=('git' 'python-setuptools-scm')
optdepends=('cuneiform: OCR backend'
            'tesseract: OCR backend')
_commit=920b07154e1240efbd16e5b0bfd5fe2b57ac8334
source=("git+https://gitlab.gnome.org/World/OpenPaperwork/pyocr.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $_pkgname
  git revert -n c11aa77bea433f0a6f75d077bd7871a7fc0c54c1 # Remove version constraint
  sed -e '/setuptools_scm_git_archive/d' -i setup.py # Remove unused makedepends
}

build() {
  cd $_pkgname
  python setup.py build
}

package() {
  cd $_pkgname
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}
